<template>
  <span @click="importPhoto">导出照片</span>
</template>
<script setup>
import { getCurrentInstance, onMounted } from "vue";
let $map;
onMounted(() => {
  const { proxy } = getCurrentInstance();
  $map = proxy.$map;
});
const importPhoto = () => {
  $map.once("postcompose", function (event) {
    const canvas = event.context.canvas;
    canvas.toBlob(function (blob) {
      saveAs(blob, "photo.png");
    });
  });
  $map.renderSync();
};
</script>
<style scoped></style>
